Skip to content

Fix: Video public view for anonymous users on public courses#38015

Closed
farhan wants to merge 1 commit intomasterfrom
farhan/fix-video-public-view
Closed

Fix: Video public view for anonymous users on public courses#38015
farhan wants to merge 1 commit intomasterfrom
farhan/fix-video-public-view

Conversation

@farhan
Copy link
Contributor

@farhan farhan commented Feb 17, 2026

Fix video public view feature via vibe coding using Cursor and It needs to be critically reviewed

Below the LLM cursor generated PR description.


Fix: Video public view for anonymous users on public courses

Summary

Fixes the Learning MFE courseware experience for anonymous users on public courses with unenrolled access enabled. Previously the page either redirected to login or showed "An unexpected error occurred" where the video block should be. This PR fixes the underlying backend issues so the page loads and the video section renders.

Problem

  • Anonymous users opening a public course in the Learning MFE (e.g. in incognito) were redirected to login or saw a generic error in place of the video.
  • LMS logs showed:
    1. Navigation API 500BlockCompletion.objects.filter(user=self.request.user, ...) used AnonymousUser, causing TypeError: Cannot cast AnonymousUser to int.
    2. Video block 500WebpackBundleLookupError: Cannot resolve bundle VideoBlockMain when rendering the video block's public view.
    3. Access – Anonymous users were denied "load" access to the course/block or hit start-date redirects even when the course was public.

Solution

Area Change
Course/block access (courseware/access.py) For anonymous users, allow "load" access to the course and to blocks when the course is public (via check_public_access(..., COURSE_VISIBILITY_PUBLIC)), without requiring enrollment or a user id.
Start-date redirect (courseware/courses.py) For anonymous users on public courses, do not redirect on StartDateError; allow them to reach the courseware.
Navigation API (course_home_api/outline/views.py) In CourseBlocksView.completions_dict, return an empty completion map when request.user.is_anonymous so the navigation API never queries BlockCompletion with AnonymousUser.
Video block render (xmodule/video_block/video_block.py) In public_view, catch WebpackBundleLookupError when adding the VideoBlockMain bundle and continue without the bundle so the fragment (HTML) still returns and the video area loads instead of returning 500.

Preconditions

  • Course visibility is set to Public in Studio.
  • Course Enable Unenrolled Access waffle (course_experience.course_enable_unenrolled_access) is enabled for the course or globally.

Testing

  • As an anonymous user (or in an incognito window), open the Learning MFE URL for a public course with unenrolled access enabled (e.g. .../learning/course/course-v1:org+course+run/block-v1:...).
  • Confirm: no redirect to login, course outline/navigation loads, and the video block section renders (with or without the interactive VideoBlockMain bundle, depending on webpack build).

- courseware/access: allow block and course load for anonymous on public courses
- courseware/courses: do not redirect anonymous on StartDateError when public
- course_home_api/outline: return empty completions for anonymous in navigation API
- video_block: handle missing VideoBlockMain webpack bundle in public_view
@farhan farhan force-pushed the farhan/fix-video-public-view branch from 94d5262 to cae1786 Compare February 17, 2026 15:15
@farhan farhan changed the title Fix video public view feature via vibe coding Fix: Video public view for anonymous users on public courses Feb 17, 2026
@farhan farhan moved this to 🏗 In progress in Aximprovements Team Feb 17, 2026
@farhan
Copy link
Contributor Author

farhan commented Feb 17, 2026

Closing the PR as it was created for the testing purpose.

@farhan farhan closed this Feb 17, 2026
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Aximprovements Team Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant